<!DOCTYPE html><html class=split lang=en-US-x-hixie><script src=../link-fixup.js defer=""></script>
<!-- Mirrored from html.spec.whatwg.org/dev/system-state.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 10 Sep 2025 08:36:28 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<meta charset=utf-8><meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name=viewport><title>HTML Standard, Edition for Web Developers</title><meta content=#3c790a name=theme-color><meta content="light dark" name=color-scheme><link rel=stylesheet href=../../resources.whatwg.org/standard-shared-with-dev.css crossorigin=""><link rel=icon href=https://resources.whatwg.org/logo.svg crossorigin=""><link rel=stylesheet href=styles.css crossorigin=""><script>
   function toggleStatus(div) {
     div.parentNode.classList.toggle('wrapped');
   }
   function setLinkFragment(link) {
     link.hash = location.hash;
   }
  </script><body>
  <script async="" src=search.js></script>
  
  
  <header id=head class="head with-buttons">
   <a href=https://whatwg.org/ class=logo><img width=100 alt=WHATWG crossorigin="" class=darkmode-aware src=https://resources.whatwg.org/logo.svg height=100></a>
   
   <hgroup><h1><a rel=home href=index.html>HTML: The Living Standard</a></h1><p id=dev-edition-h2>Edition for Web Developers — Last Updated <span class=pubdate>10 September 2025</span></hgroup>
   

   <div id=search>
    <input placeholder="Search. Press '/'" autocomplete=off name=query id=query type=search>
    <ol id=results></ol>
   </div>
  </header>

  

  

  

  
  

  
  

  

  <nav><a href=timers-and-user-prompts.html>← 8.6 Timers</a> — <a href=index.html>Table of Contents</a> — <a href=imagebitmap-and-animations.html>8.10 Images →</a></nav><ol class=toc><li><ol><li><a href=system-state.html#system-state-and-capabilities><span class=secno>8.9</span> System state and capabilities</a><ol><li><a href=system-state.html#the-navigator-object><span class=secno>8.9.1</span> The <code>Navigator</code> object</a><ol><li><a href=system-state.html#client-identification><span class=secno>8.9.1.1</span> Client identification</a><li><a href=system-state.html#language-preferences><span class=secno>8.9.1.2</span> Language preferences</a><li><a href=system-state.html#navigator.online><span class=secno>8.9.1.3</span> Browser state</a><li><a href=system-state.html#custom-handlers><span class=secno>8.9.1.4</span> Custom scheme handlers: the <code>registerProtocolHandler()</code> method</a><li><a href=system-state.html#cookies><span class=secno>8.9.1.5</span> Cookies</a><li><a href=system-state.html#pdf-viewing-support><span class=secno>8.9.1.6</span> PDF viewing support</a></ol></ol></ol></ol><h3 id=system-state-and-capabilities><span class=secno>8.9</span> System state and capabilities<a href=#system-state-and-capabilities class=self-link></a></h3>

  <h4 id=the-navigator-object><span class=secno>8.9.1</span> The <code>Navigator</code> object<a href=#the-navigator-object class=self-link></a></h4><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Navigator title="The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.">Navigator</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div>

  <p>Instances of <code>Navigator</code> represent the identity and state of the user agent (the
  client). It has also been used as a generic global under which various APIs are located, but this
  is not precedent to build upon. Instead use the <code>WindowOrWorkerGlobalScope</code> mixin or
  equivalent.</p>

  

  


  <h5 id=client-identification><span class=secno>8.9.1.1</span> Client identification<a href=#client-identification class=self-link></a></h5>

  

  <p>In certain cases, despite the best efforts of the entire industry, web browsers have bugs and
  limitations that web authors are forced to work around.</p>

  <p>This section defines a collection of attributes that can be used to determine, from script, the
  kind of user agent in use, in order to work around these issues.</p>

  

  <p>Client detection should always be limited to detecting known current versions; future versions
  and unknown versions should always be assumed to be fully compliant.</p>

  <dl class=domintro><dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-appcodename>appCodeName</span></code><dd><p>Returns the string "<code>Mozilla</code>".<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-appname>appName</span></code><dd><p>Returns the string "<code>Netscape</code>".<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-appversion>appVersion</span></code><dd><p>Returns the version of the browser.<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-platform>platform</span></code><dd><p>Returns the name of the platform.<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-product>product</span></code><dd><p>Returns the string "<code>Gecko</code>".<dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-productsub>productSub</span></code><dd><p>Returns either the string "<code>20030107</code>", or the string "<code>20100101</code>".<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-useragent>userAgent</span></code><dd><p>Returns the complete `<code>User-Agent</code>` header.<dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-vendor>vendor</span></code><dd><p>Returns either the empty string, the string "<code>Apple Computer, Inc.</code>",
   or the string "<code>Google Inc.</code>".<dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-vendorsub>vendorSub</span></code><dd><p>Returns the empty string.</dl>

  

  

  <h5 id=language-preferences><span class=secno>8.9.1.2</span> Language preferences<a href=#language-preferences class=self-link></a></h5>

  

  <dl class=domintro><dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-language>language</span></code><dd><p>Returns a language tag representing the user's preferred language.<dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-languages>languages</span></code><dd>
    <p>Returns an array of language tags representing the user's preferred languages, with the most
    preferred language first.</p>

    <p>The most preferred language is the one returned by <code id=language-preferences:dom-navigator-language><a href=#dom-navigator-language>navigator.language</a></code>.</p>
   </dl>

  <p class=note>A <code id=language-preferences:event-languagechange><a href=indices.html#event-languagechange>languagechange</a></code> event is fired at the
  <code>Window</code> or <code id=language-preferences:workerglobalscope><a href=workers.html#workerglobalscope>WorkerGlobalScope</a></code> object when the user agent's understanding
  of what the user's preferred languages are changes.</p>

  


  <h5 id=navigator.online><span class=secno>8.9.1.3</span> <span id=browser-state></span>Browser state<a href=#navigator.online class=self-link></a></h5>

  

  <dl class=domintro><dt><code><var>self</var>.<span>navigator</span>.<span id=dom-navigator-online>onLine</span></code><dd>
    <p>Returns false if the user agent is definitely offline (disconnected from the network).
    Returns true if the user agent might be online.</p>

    <p>The events <code id=navigator.online:event-online><a href=indices.html#event-online>online</a></code> and <code id=navigator.online:event-offline><a href=indices.html#event-offline>offline</a></code> are fired when the value of this attribute changes.</p>
   </dl>

  

  <p class=note>This attribute is inherently unreliable. A computer can be connected to a network
  without having Internet access.</p>

  <div class=example>
   <p>In this example, an indicator is updated as the browser goes online and offline.</p>

   <pre><code class='html'><c- cp>&lt;!DOCTYPE HTML&gt;</c->
<c- p>&lt;</c-><c- f>html</c-> <c- e>lang</c-><c- o>=</c-><c- s>&quot;en&quot;</c-><c- p>&gt;</c->
 <c- p>&lt;</c-><c- f>head</c-><c- p>&gt;</c->
  <c- p>&lt;</c-><c- f>title</c-><c- p>&gt;</c->Online status<c- p>&lt;/</c-><c- f>title</c-><c- p>&gt;</c->
  <c- p>&lt;</c-><c- f>script</c-><c- p>&gt;</c->
   <c- a>function</c-> updateIndicator<c- p>()</c-> <c- p>{</c->
     document<c- p>.</c->getElementById<c- p>(</c-><c- t>&apos;indicator&apos;</c-><c- p>).</c->textContent <c- o>=</c-> navigator<c- p>.</c->onLine <c- o>?</c-> <c- t>&apos;online&apos;</c-> <c- o>:</c-> <c- t>&apos;offline&apos;</c-><c- p>;</c->
   <c- p>}</c->
  <c- p>&lt;/</c-><c- f>script</c-><c- p>&gt;</c->
 <c- p>&lt;/</c-><c- f>head</c-><c- p>&gt;</c->
 <c- p>&lt;</c-><c- f>body</c-> <c- e>onload</c-><c- o>=</c-><c- s>&quot;updateIndicator()&quot;</c-> <c- e>ononline</c-><c- o>=</c-><c- s>&quot;updateIndicator()&quot;</c-> <c- e>onoffline</c-><c- o>=</c-><c- s>&quot;updateIndicator()&quot;</c-><c- p>&gt;</c->
  <c- p>&lt;</c-><c- f>p</c-><c- p>&gt;</c->The network is: <c- p>&lt;</c-><c- f>span</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;indicator&quot;</c-><c- p>&gt;</c->(state unknown)<c- p>&lt;/</c-><c- f>span</c-><c- p>&gt;</c->
 <c- p>&lt;/</c-><c- f>body</c-><c- p>&gt;</c->
<c- p>&lt;/</c-><c- f>html</c-><c- p>&gt;</c-></code></pre>
  </div>


  <h5 id=custom-handlers><span class=secno>8.9.1.4</span> Custom scheme handlers: the <code id=custom-handlers:dom-navigator-registerprotocolhandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> method<a href=#custom-handlers class=self-link></a></h5><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler title="The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular URL schemes (aka protocols).">Navigator/registerProtocolHandler</a><div class=support><span class="firefox yes"><span>Firefox</span><span>2+</span></span><span class="safari no"><span>Safari</span><span>No</span></span><span class="chrome yes"><span>Chrome</span><span>13+</span></span><hr><span class="opera yes"><span>Opera</span><span>11.6+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge no"><span>Edge (Legacy)</span><span>No</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android no"><span>Chrome Android</span><span>No</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div>

  

  <dl class=domintro><dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-registerprotocolhandler>registerProtocolHandler</span>(<var>scheme</var>, <var>url</var>)</code><dd>
    <p>Registers a handler for <var>scheme</var> at <var>url</var>. For example, an online telephone
    messaging service could register itself as a handler of the <code id=custom-handlers:sms-protocol><a data-x-internal=sms-protocol href=https://www.rfc-editor.org/rfc/rfc5724#section-2>sms:</a></code> scheme, so that if the user clicks on such a link, they are given the
    opportunity to use that web site. <a href=references.html#refsSMS>[SMS]</a></p>

    <p>The string "<code>%s</code>" in <var>url</var> is used as a placeholder for where
    to put the URL of the content to be handled.</p>

    <p>Throws a <a id=custom-handlers:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=custom-handlers:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> if the user
    agent blocks the registration (this might happen if trying to register as a handler for "<code>http</code>", for instance).</p>

    <p>Throws a <a id=custom-handlers:syntaxerror href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a> <code id=custom-handlers:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> if the "<code>%s</code>" string is missing in <var>url</var>.</p>
   <dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler</span>(<var>scheme</var>, <var>url</var>)</code><dd>
    <p>Unregisters the handler given by the arguments.</p>

    <p>Throws a <a id=custom-handlers:securityerror-2 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=custom-handlers:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> if the user
    agent blocks the deregistration (this might happen if with invalid schemes, for instance).</p>

    <p>Throws a <a id=custom-handlers:syntaxerror-2 href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a> <code id=custom-handlers:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> if the "<code>%s</code>" string is missing in <var>url</var>.</p>
   </dl>


  

  <h5 id=cookies><span class=secno>8.9.1.5</span> Cookies<a href=#cookies class=self-link></a></h5>

  

  <dl class=domintro><dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-cookieenabled>cookieEnabled</span></code><dd><p>Returns false if setting a cookie will be ignored, and true otherwise.</dl>

  

  <h5 id=pdf-viewing-support><span class=secno>8.9.1.6</span> PDF viewing support<a href=#pdf-viewing-support class=self-link></a></h5>

  <dl class=domintro><dt><code><var>window</var>.<span>navigator</span>.<span id=dom-navigator-pdfviewerenabled>pdfViewerEnabled</span></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Navigator/pdfViewerEnabled title="The pdfViewerEnabled property of the Navigator interface indicates whether the browser supports inline display of PDF files when navigating to them.">Navigator/pdfViewerEnabled</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>99+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome yes"><span>Chrome</span><span>94+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>94+</span></span><hr><span class="edge unknown"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd><p>Returns true if the user agent supports inline viewing of PDF files when <a href=browsing-the-web.html#navigate id=pdf-viewing-support:navigate>navigating</a> to them, or false otherwise. In the latter case, PDF files
   will be handled by <a href=browsing-the-web.html#hand-off-to-external-software id=pdf-viewing-support:hand-off-to-external-software>external
   software</a>.</dl>

  

  


  <nav><a href=timers-and-user-prompts.html>← 8.6 Timers</a> — <a href=index.html>Table of Contents</a> — <a href=imagebitmap-and-animations.html>8.10 Images →</a></nav>
